﻿using System;

namespace BruteForce.Characters
{
    [Serializable()]
    public class Resources
    {
        public int Life;
        public int Light;
        public int Power;
        public int Speed;
        private Resources InitialResources;

        public Resources(int light, int power, int life, int speed)
        {
            Light = light;
            Power = power;
            Life = life;
            Speed = speed;
        }

        public Resources(Resources InitialResources)
        {
            Light = InitialResources.Light;
            Power = InitialResources.Power;
            Life = InitialResources.Life;
            Speed = InitialResources.Speed;
        }

        public void AddResources(Resources toAdd)
        {
            if (toAdd == null) return;
            
            Light += toAdd.Light;
            Power += toAdd.Power;
            Life += toAdd.Life;
            Speed += toAdd.Speed;
        }

        public void RemoveResources(Resources toAdd)
        {
            Light -= toAdd.Light;
            Power -= toAdd.Power;
            Life -= toAdd.Life;
            Speed -= toAdd.Speed;
        }


        public string ToString()
        {
            return "Life = " + Life +
                   "\nLight = " + Light +
                   "\nSpeed = " + Speed +
                   "\npower = " + Power;
        }
    }
}